import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/pages/goods/entity/activity_item_entity.dart';

ActivityItemEntity $ActivityItemEntityFromJson(Map<String, dynamic> json) {
  final ActivityItemEntity activityItemEntity = ActivityItemEntity();
  final String? marketingId = jsonConvert.convert<String>(json['marketingId']);
  if (marketingId != null) {
    activityItemEntity.marketingId = marketingId;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    activityItemEntity.type = type;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    activityItemEntity.status = status;
  }
  final int? preNotice = jsonConvert.convert<int>(json['preNotice']);
  if (preNotice != null) {
    activityItemEntity.preNotice = preNotice;
  }
  final String? begindate = jsonConvert.convert<String>(json['begindate']);
  if (begindate != null) {
    activityItemEntity.begindate = begindate;
  }
  final String? enddate = jsonConvert.convert<String>(json['enddate']);
  if (enddate != null) {
    activityItemEntity.enddate = enddate;
  }
  final String? beginDatetime = jsonConvert.convert<String>(json['beginDatetime']);
  if (beginDatetime != null) {
    activityItemEntity.beginDatetime = beginDatetime;
  }
  final String? endDatetime = jsonConvert.convert<String>(json['endDatetime']);
  if (endDatetime != null) {
    activityItemEntity.endDatetime = endDatetime;
  }
  final String? begintime = jsonConvert.convert<String>(json['begintime']);
  if (begintime != null) {
    activityItemEntity.begintime = begintime;
  }
  final String? endtime = jsonConvert.convert<String>(json['endtime']);
  if (endtime != null) {
    activityItemEntity.endtime = endtime;
  }
  final int? targetType = jsonConvert.convert<int>(json['targetType']);
  if (targetType != null) {
    activityItemEntity.targetType = targetType;
  }
  final int? activityType = jsonConvert.convert<int>(json['activityType']);
  if (activityType != null) {
    activityItemEntity.activityType = activityType;
  }
  return activityItemEntity;
}

Map<String, dynamic> $ActivityItemEntityToJson(ActivityItemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['marketingId'] = entity.marketingId;
  data['type'] = entity.type;
  data['status'] = entity.status;
  data['preNotice'] = entity.preNotice;
  data['begindate'] = entity.begindate;
  data['enddate'] = entity.enddate;
  data['beginDatetime'] = entity.beginDatetime;
  data['endDatetime'] = entity.endDatetime;
  data['begintime'] = entity.begintime;
  data['endtime'] = entity.endtime;
  data['targetType'] = entity.targetType;
  data['activityType'] = entity.activityType;
  return data;
}

extension ActivityItemEntityExtension on ActivityItemEntity {
  ActivityItemEntity copyWith({
    String? marketingId,
    int? type,
    int? status,
    int? preNotice,
    String? begindate,
    String? enddate,
    String? beginDatetime,
    String? endDatetime,
    String? begintime,
    String? endtime,
    int? targetType,
    int? activityType,
  }) {
    return ActivityItemEntity()
      ..marketingId = marketingId ?? this.marketingId
      ..type = type ?? this.type
      ..status = status ?? this.status
      ..preNotice = preNotice ?? this.preNotice
      ..begindate = begindate ?? this.begindate
      ..enddate = enddate ?? this.enddate
      ..beginDatetime = beginDatetime ?? this.beginDatetime
      ..endDatetime = endDatetime ?? this.endDatetime
      ..begintime = begintime ?? this.begintime
      ..endtime = endtime ?? this.endtime
      ..targetType = targetType ?? this.targetType
      ..activityType = activityType ?? this.activityType;
  }
}
